package com.yaj.mesif.service.impl;

import com.yaj.mesif.dto.Ifi1006Dto;
import com.yaj.mesif.dto.TiCompoItemDto;
import com.yaj.mesif.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
@Slf4j
public class IFI1006ServiceImpl implements IFI1006Service {
    @Autowired
    private TiOrderService tiOrderService;

    @Autowired
    private TiBlptService tiBlptService;

    @Autowired
    private TiCompoItemService tiCompoItemService;

    @Autowired
    private P2TCosnoService p2TCosnoService;

    @Autowired
    private P2TOrdMsgService p2TOrdMsgService;

    @Override
    public void ifi1006(Ifi1006Dto ifi1006Dto) {
        tiOrderService.RegTiOrder(ifi1006Dto.getTiOrderDto());

        tiBlptService.RegTiBlpt(ifi1006Dto.getTiBlptDto());

        for (TiCompoItemDto tiCompoItemDto:ifi1006Dto.getTiCompoItemDtos()
        ) {
            tiCompoItemService.RegTiCompoItem(tiCompoItemDto);
        }

        p2TCosnoService.RegP2Cosno(ifi1006Dto.getP2TCosnoDto());

        p2TOrdMsgService.RegP2TordMsg(ifi1006Dto.getP2TOrdMsgDto(),ifi1006Dto.getP2TCosnoDto());
        }
    }

